package ovt;

public class HashLogic {
	public static long RSHash(String str) {
		int b = 378551;
		int a = 63689;
		long hash = 0;
		for (int i = 0; i < str.length(); i++) {
			hash = hash * a + str.charAt(i);
			a = a * b;
		}
		return hash;
	}

	public static long JSHash(String str) {
		long hash = 1315423911;
		for (int i = 0; i < str.length(); i++) {
			hash ^= ((hash << 5) + str.charAt(i) + (hash >> 2));
		}
		return hash;
	}
	
	public static void main(String[] args)
	{
		String filename = "dfecfs.jpg";
		System.out.println(JSHash(filename));
		filename = "feitfef.jpg";
		System.out.println(JSHash(filename));
		filename = "fedwei4.jpg";
		System.out.println(JSHash(filename));
		filename = "cerdeceg.jpg";
		System.out.println(JSHash(filename));
		filename = "fe3rdd2dfe.jpg";
		System.out.println(JSHash(filename));
		filename = "e3243tt43d.jpg";
		System.out.println(JSHash(filename));
		filename = "f3erhy6r32546.jpg";
		System.out.println(JSHash(filename));
	}
}
